package com.android.butterknife;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnPageChange;
import butterknife.OnPageChange.Callback;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.Log;

public class ViewPagerActivity extends Activity {

	@Bind(R.id.viewpager)
	ViewPager mViewPager;
	ImgPageAdapter mAdapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_viewpager);
		ButterKnife.bind(this);

		mAdapter = new ImgPageAdapter(this);
		mViewPager.setAdapter(mAdapter);
	}

	@OnPageChange(value = R.id.viewpager, callback = Callback.PAGE_SCROLL_STATE_CHANGED)
	void onPageScrollSateCahnged(int state) {
		Log.e("ViewPagerActivity", "onPageScrollSateCahnged:" + state);
	}

	@OnPageChange(value = R.id.viewpager, callback = Callback.PAGE_SCROLLED)
	void onPageScrolled(int start, float progress, int end) {
		Log.e("ViewPagerActivity", "onPageScrolled:start:" + start
				+ ";progress:" + progress + ";end:" + end);
	}

	@OnPageChange(value = R.id.viewpager, callback = Callback.PAGE_SELECTED)
	void onPageSelected(int position) {
		Log.e("ViewPagerActivity", "onPageSelected:" + position);
	}

}
